package com.google.code.fishing.gui;

import java.awt.*;
import java.io.File;
import java.util.Iterator;
import javax.swing.*;

class LoadingScreen extends JWindow {

    private int duration;
    private String oestat = "oestat.xml";
    public JProgressBar progressBar;
    //private static DuplicationFinder show = new DuplicationFinder();

    public LoadingScreen(int d) {
        duration = d;
    }

    // A simple little method to show a title screen in the center
    // of the screen for the amount of time given in the constructor
    public void showSplash() {

        JPanel content = (JPanel) getContentPane();
        content.setBackground(Color.white);

        // Set the window's bounds, centering the window
        int width = 350;
        int height = 250;
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (screen.width - width) / 2;
        int y = (screen.height - height) / 2;
        setBounds(x, y, width, height);
        //show.setBounds(x, y, width+5, 425);

        // Build the splash screen
        JLabel label = new JLabel(new ImageIcon(getClass().getResource("/com/google/code/fishing/images/logo.gif")));
        JLabel copyrt = new JLabel("Fishing Administration Tool", JLabel.CENTER);
        copyrt.setFont(new Font("Verdana", Font.ITALIC, 9));
        content.add(label, BorderLayout.NORTH);
        content.add(copyrt, BorderLayout.CENTER);
        Color oraRed = new Color(0, 0, 0, 255);
        content.setBorder(BorderFactory.createLineBorder(oraRed, 1));



        // Display it
        setVisible(true);


        // Wait a little while, maybe while loading resources

        try {
            Thread.sleep(duration);
        } catch (Exception e) {

        }

        setVisible(false);

    }

    public static void main(String[] args) {

        // Throw a nice little title page up on the screen first
        
        LoadingScreen splash = new LoadingScreen(1500);




        

        // Normally, we'd call splash.showSplash() and get on
        // with the program. But, since this is only a test...
        splash.showSplash();
        
        

        //show.setVisible(true);

    }
}
